import io.github.bonigarcia.wdm.WebDriverManager;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;

import java.util.List;

public class Test {

    /**
     * @param args
     */

    public static void main(String[] args) throws Exception {
        WebDriverManager.chromedriver().setup();

        //System.setProperty("webdriver.chrome.driver", "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chromedriver.exe");
        WebDriver driver = new ChromeDriver();
        try {
            driver.get("https://www.zhipin.com/job_detail/?query=成都信通信息技术有限公司&city=101270100&industry=&position=");

            //鼠标右键点击指定的元素 contextClick()
            //Actions action = new Actions(driver);
            System.out.println(driver.findElement(By.className("company-name")).findElements(By.tagName("a")).get(0).getAttribute("innerHTML"));
            String companyAddrInfo = driver.findElement(By.className("company-name")).getAttribute("innerHTML");
            int endIndex = companyAddrInfo.indexOf("ka=\"search_rcmd_company_");
            companyAddrInfo = companyAddrInfo.substring(10, endIndex - 2);
            System.out.println(companyAddrInfo);
            //webElement.click();
            //action.doubleClick(webElement).perform();
            driver.findElement(By.className("company-name")).findElements(By.tagName("a")).get(0).click();


            List<WebElement> jobElements = driver.findElements(By.className("job-primary"));

            System.out.println("The testing page title is: " + driver.getTitle());

        } finally {
           // driver.quit();
        }


    }

}